//
//  LBAnsenFilter.mm
//  OpenGLGame
//
//  Created by Nguyen Cong Huy on 4/2/13.
//  Copyright (c) 2013 UIT. All rights reserved.
//

#include "LBAnsenFilter.h"
#include "LBSaturationFilter.h"
#include "LBOverlayTextureFilter.h"
#include "LBOverlayColorFilter.h"
#include "LBExclusionColorFilter.h"
#include "LBBrightnessFilter.h"
#include "LBContrastFilter.h"
#include "LBUtils.h"

LBAnsenFilter::LBAnsenFilter(){
    
    saturation = new LBSaturationFilter();
    saturation->setSaturation(0.0);
    
    gradientOverlay = new LBOverlayTextureFilter();
    gradientOverlay->setOpactiy(0.2);
    
    overlayColor = new LBOverlayColorFilter();
    overlayColor->setColor(0.325, 0.263, 0.208);
    overlayColor->setOpactiy(0.2);
    
    exclusion = new LBExclusionColorFilter();
    exclusion->setColor(0.0, 0.178, 0.314);
    exclusion->setOpactiy(0.2);
    
    brightness = new LBBrightnessFilter();
    brightness->setBrightness(0.05);
    
    contrast = new LBContrastFilter();
    contrast->setContrast(1.2);
    
    saturation->addTarget(gradientOverlay)->addTarget(overlayColor)->addTarget(exclusion)->addTarget(brightness)->addTarget(contrast);
    firstFilter = saturation;
}

LBAnsenFilter::~LBAnsenFilter(){
    outputTexture = 0;
    DELETE_SAFELY(saturation);
    DELETE_SAFELY(gradientOverlay);
    DELETE_SAFELY(overlayColor);
    DELETE_SAFELY(exclusion);
    DELETE_SAFELY(brightness);
    DELETE_SAFELY(contrast);
}

void LBAnsenFilter::setBlendTexture(LBTexture* blendTexture){
    gradientOverlay->setBlendTexture(blendTexture);
}